package com.teng.smartdrawer.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;

/**
 * 自动扩充尺寸的ListView，适用于 ScrollView + ListView
 */
public class FullListView extends ListView {

    public FullListView(Context context) {
        super(context);
    }

    public FullListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        heightMeasureSpec =
                MeasureSpec.makeMeasureSpec(
                        Integer.MAX_VALUE >> 2,// size 控件可以显示的最大高度
                        MeasureSpec.AT_MOST
                );

        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }
}

